package com.rosh.provider.service;

import com.alibaba.fastjson.JSONObject;
import com.rosh.rpc.core.annotation.RoshRpcService;
import com.rosh.rpc.server.config.RpcServerConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import com.rosh.api.student.StudentService;


/**
 * @Description:
 * @Author: rosh
 * @Date: 2022/6/12 18:05
 */
@RoshRpcService(interfaceClass = StudentService.class)
public class StudentServiceImpl implements StudentService {

    @Autowired
    private RpcServerConfiguration rpcServerConfiguration;


    @Override
    public String getStudent(Integer id) {
        int rpcPort = rpcServerConfiguration.getRpcPort();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("id", id);
        jsonObject.put("rpcPort", rpcPort);
        jsonObject.put("name", "rosh");
        return jsonObject.toJSONString();
    }
}
